package com.shankungfu.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.shankungfu.R;

public class MessageAdapter extends BaseAdapter {

	private Context context;
	private List<Object> list;

	public MessageAdapter(Context context, List<Object> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = View.inflate(context, R.layout.pickitem_detail_pic_layout,
					null);
//			holder.bt = (Button) convertView.findViewById(R.id.button1);
			
			holder.pic = (ImageView) convertView.findViewById(R.id.image);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

//		holder.bt.setText(position + "");
		holder.pic.setImageResource(R.drawable.default_icon);

		return convertView;
	}

	private class ViewHolder {
		private ImageView pic;
	}

}
